def merge(nums1: list, m: int, nums2: list, n: int):
    """
    :type nums1: List[int]
    :type m: int
    :type nums2: List[int]
    :type n: int
    :rtype: None Do not return anything, modify nums1 in-place instead.
    """
    result_index = m + n - 1
    nums1_index = m - 1
    nums2_index = n - 1
    while nums1_index >= 0 and nums2_index >= 0:
        if nums1[nums1_index] <= nums2[nums2_index]:
            nums1[result_index] = nums2[nums2_index]
            nums2_index -= 1
        else:
            nums1[result_index] = nums1[nums1_index]
            nums1_index -= 1

        result_index -= 1

    if nums1_index <= 0:
        while result_index >= 0 and nums2_index >= 0:
            nums1[result_index] = nums2[nums2_index]
            nums2_index -= 1
            result_index -= 1

    if nums2_index <= 0:
        while result_index >= 0:
            nums1[result_index] = nums1[nums1_index]
            nums1_index -= 1
            result_index -= 1


def merge_short(nums1: list, m: int, nums2: list, n: int):
    # 把 nums2 数组，复制到 nums1 数组
    print(f"merge_short：nums1 : {nums1}, nums2 : {nums2}")
    nums1[m:] = nums2
    print(f"merge_short：nums1 : {nums1}, nums2 : {nums2}")
    nums1.sort()
    print(f"merge_short：nums1: {nums1}, nums2 : {nums2}")


# case1
list1 = [1, 2, 3, 0, 0, 0]
list2 = [2, 5, 6]
merge_short(list1, 3, list2, 3)
print(list1)

# case2
list1 = [0]
list2 = [1]
merge_short(list1, 0, list2, 1)
print(list1)

# case3
list1 = [1]
list2 = []
merge_short(list1, 1, list2, 0)
print(list1)
